﻿package  {
	
	import app.core.action.TapScroller;
	
	import com.DragMomentum;
	import com.facebook.graph.FacebookDesktop;
	import com.obj.*;
	import com.obj.ListPrinterSelect;
	import com.selectPrinter;
	
	import flash.display.GradientType;
	import flash.display.MovieClip;
	import flash.display.NativeWindow;
	import flash.display.SpreadMethod;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.MouseEvent;
	import flash.geom.Matrix;
	import flash.printing.PaperSize;
	import flash.printing.PrintJob;
	import flash.printing.PrintMethod;
	import flash.printing.PrintUIOptions;
	
	
	
	
	
	public class Main extends MovieClip {
		
		
		public var  printerSelect:String="abc";
	
		
		public function Main() {
				// constructor code
				
				this.stage.scaleMode = StageScaleMode.NO_SCALE;
				this.stage.align = StageAlign.TOP_LEFT; 


				var pl:ListPrinterSelect = new ListPrinterSelect(root as MovieClip);
					pl.x = 200;
					pl.y = 100;
					addChild(pl);
					
					
				
				var fb:FlashDesktopMain = new FlashDesktopMain();
					addChild(fb);
					

				
				//for(var i:int=0;i<10;i++){
				


				/*
				var DM:DragMomentum = new DragMomentum();
				
				
				
				var mcArray:Array = new Array();
				
					mcArray.push("johhnie", "keke", "Shaman","a","b","c","d");
				
				for (var i:uint = 0; i < mcArray.length; i++)
				{
				var myClip:PRINTER_ITEM = new PRINTER_ITEM();
						myClip.name = "mc" + i;
						var buttonX:Number = 60;
						var buttonY:Number = 10;
						var buttonSpacing:Number = 60;
						myClip.x =  buttonX;    
						myClip.y = buttonY + i * buttonSpacing;
						addChild(myClip);
						DM.gin(myClip);
						myClip.addEventListener(MouseEvent.CLICK, clickHandler);
				}*/
				
				
				
				} 
				
			public function testPrint(){
					trace("printer:"+printerSelect);
					

					
					var myPrintJob:PrintJob = new PrintJob();
					
					myPrintJob.printer = printerSelect;
					//myPrintJob.showPageSetupDialog();
					
					
					var mySprite:Sprite = new Sprite();
					mySprite.graphics.beginFill(0x336699);
					mySprite.graphics.drawCircle(100, 100, 50);
					
					var uiOpt:PrintUIOptions = new PrintUIOptions();
					uiOpt.minPage = 1;
					uiOpt.maxPage = 1;
					
					
					
					var accepted:Boolean = myPrintJob.start2(uiOpt,false);
					myPrintJob.addPage(mySprite);
					
					
				
						
				
					
					
				
				}
				
			private function clickHandler(e:MouseEvent){
				 trace ("Clicked on: " + e.currentTarget.name.toString() );
				
				}
				
				
				
			}
			
}